home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
virtltxt
/
inimaint.bas
< prev
next >
Wrap
BASIC Source File
|
1994-01-21
|
23KB
|
695 lines
'INIMAINT.BAS: VBC Version
Sub ChangeFileList (filestr$)
IniFileName$ = "VIRTEXT.INI" 'name of ini file
AppName$ = "Display" 'Name of application or section heading
KeyName$ = "File1" 'Keyword or variable name"
DefaultStr$ = "NONE"
Numeric% = 0 'Tell it we are looking for a string
ReadIni AppName$, KeyName$, nDefault, DefaultStr$, ReturnStr$, Numeric%, IniFileName$
'***********************************************************
' If NONE is returned the file does not exist - create it
'***********************************************************
If ReturnStr$ = "NONE" Then
SaveFileINIFile
SaveOptions
End If
'***********************************************************
'* Get the files that are saved we'll move them down one
'***********************************************************
For X = 1 To 5
Select Case X
Case 1
KeyName$ = "File1" 'Keyword or variable name"
Case 2
KeyName$ = "File2" 'Keyword or variable name"
Case 3
KeyName$ = "File3" 'Keyword or variable name"
Case 4
KeyName$ = "File4" 'Keyword or variable name"
Case 5
KeyName$ = "File5" 'Keyword or variable name"
End Select
DefaultStr$ = " " 'Default string (for String variables)
Numeric% = 0 'Tell it we are looking for a string
ReadIni AppName$, KeyName$, nDefault, DefaultStr$, ReturnStr$, Numeric%, IniFileName$
Select Case X
Case 1
File2$ = ReturnStr$ 'Keyword or variable name"
Case 2
File3$ = ReturnStr$ 'Keyword or variable name"
Case 3
File4$ = ReturnStr$ 'Keyword or variable name"
Case 4
File5$ = ReturnStr$ 'Keyword or variable name"
Case 5
File6$ = ReturnStr$ 'Keyword or variable name"
End Select
If Trim$(ReturnStr$) = Trim$(FullFilePath) Then Exit Sub
Next
' Save the file name that was just selected
For X = 1 To 5
IniFileName$ = "VIRTEXT.INI" 'name of ini file
AppName$ = "Display" 'Name of application or section heading
Select Case X
Case 1
KeyName$ = "File1" 'Keyword or variable name"
NewVal$ = FullFilePath
Case 2
KeyName$ = "File2" 'Keyword or variable name"
NewVal$ = File2$
Case 3
KeyName$ = "File3" 'Keyword or variable name"
NewVal$ = File3$
Case 4
KeyName$ = "File4" 'Keyword or variable name"
NewVal$ = File4$
Case 5
KeyName$ = "File5" 'Keyword or variable name"
NewVal$ = File5$
End Select
SaveIni AppName$, IniFileName$, KeyName$, NewVal$
If Trim$(NewVal$) <> "" Then
VirtualText.zBar1.Visible = True
VirtualText.mnuFileList(X).Visible = True
VirtualText.mnuFileList(X).Caption = "&" + Trim$(Str$(X)) + " " + NewVal$
End If
Next
End Sub
Sub ReadIni (AppName$, KeyName$, nDefault, DefaultStr$, ReturnStr$, Numeric%, IniFileName$)
' Read data from Private Profile (.ini) File
If Numeric% Then 'we are looking for integer input
Numeric% = GetPrivateProfileInt(AppName$, KeyName$, nDefault, IniFileName$)
Else
Dim RetStr As String * 255 'Create an empty string to be filled
nSize% = 255 'uncertain - possibly length of fill string
lenRetString% = GetPrivateProfileString(AppName$, KeyName$, DefaultStr$, RetStr$, nSize%, IniFileName$)
ReturnStr$ = Left$(RetStr$, lenRetString%)
End If
End Sub
Sub ReadINIFile ()
IniFileName$ = "VIRTEXT.INI" 'name of ini file
AppName$ = "Display" 'Name of application or section heading
KeyName$ = "File1" 'Keyword or variable name"
DefaultStr$ = "NONE"
Numeric% = 0 'Tell it we are looking for a string
ReadIni AppName$, KeyName$, nDefault, DefaultStr$, ReturnStr$, Numeric%, IniFileName$
'***********************************************************
' If NONE is returned the file does not exist - create it
'***********************************************************
If ReturnStr$ = "NONE" Then
' Initial Default
optPrinterFont = "Courier New"
optPrinterFontSize = Val("8.25")
optPrinterFontBold = False
optPrinterFontItalic = False
SaveFileINIFile
SaveOptions
SaveFormPosition
End If
'***********************************************************
'* Get the files that are saved
'***********************************************************
For X = 1 To 5
Select Case X
Case 1
KeyName$ = "File1" 'Keyword or variable name"
Case 2
KeyName$ = "File2" 'Keyword or variable name"
Case 3
KeyName$ = "File3" 'Keyword or variable name"
Case 4
KeyName$ = "File4" 'Keyword or variable name"
Case 5
KeyName$ = "File5" 'Keyword or variable name"
End Select
DefaultStr$ = " " 'Default string (for String variables)
Numeric% = 0 'Tell it we are looking for a string
ReadIni AppName$, KeyName$, nDefault, DefaultStr$, ReturnStr$, Numeric%, IniFileName$
If Trim$(ReturnStr$) <> "" Then
VirtualText.zBar1.Visible = True
VirtualText.mnuFileList(X).Visible = True
VirtualText.mnuFileList(X).Caption = "&" + Trim$(Str$(X)) + " " + ReturnStr$
End If
Next
'***********************************************************
'* Get the other information about the display
'***********************************************************
'*******************************
' Read the Background color
'*******************************
DefaultStr$ = " " 'Default string (for String variables)
Numeric% = 0 'Tell it we are looking for a string
KeyName$ = "BackColor" 'Keyword or variable name
ReadIni AppName$, KeyName$, nDefault, DefaultStr$, ReturnStr$, Numeric%, IniFileName$
For X = 1 To NumArrays
VirtualText.TextArray(X).BackColor = Val(ReturnStr$)
Next
'*******************************
' Read the Foreground color
'*******************************
DefaultStr$ = " " 'Default string (for String variables)
Numeric% = 0 'Tell it we are looking for a string
KeyName$ = "ForeColor" 'Keyword or variable name
ReadIni AppName$, KeyName$, nDefault, DefaultStr$, ReturnStr$, Numeric%, IniFileName$
For X = 1 To NumArrays
VirtualText.TextArray(X).ForeColor = Val(ReturnStr$)
Next
'*******************************
' Read the FontName Setting
'*******************************
DefaultStr$ = " " 'Default string (for String variables)
Numeric% = 0 'Tell it we are looking for a string
KeyName$ = "FontName" 'Keyword or variable name
ReadIni AppName$, KeyName$, nDefault, DefaultStr$, ReturnStr$, Numeric%, IniFileName$
For X = 1 To NumArrays
VirtualText.TextArray(X).FontName = ReturnStr$
Next
'*******************************
' Read the FontSize Setting
'*******************************
DefaultStr$ = " " 'Default string (for String variables)
Numeric% = 0 'Tell it we are looking for a string
KeyName$ = "FontSize" 'Keyword or variable name
ReadIni AppName$, KeyName$, nDefault, DefaultStr$, ReturnStr$, Numeric%, IniFileName$
For X = 1 To NumArrays
VirtualText.TextArray(X).FontSize = Val(ReturnStr$)
Next
'*******************************
' Read the FontBold Setting
'*******************************
DefaultStr$ = " " 'Default string (for String variables)
Numeric% = 0 'Tell it we are looking for a string
KeyName$ = "FontBold" 'Keyword or variable name
ReadIni AppName$, KeyName$, nDefault, DefaultStr$, ReturnStr$, Numeric%, IniFileName$
For X = 1 To NumArrays
If ReturnStr$ = "YES" Then
VirtualText.TextArray(X).FontBold = True
Else
VirtualText.TextArray(X).FontBold = False
End If
Next
'**********